const Router = require('koa-router')
const router = new Router({ prefix: '/question/:questionId/answer' })
const jwt = require('koa-jwt')
const { find, findById, update, create, del, checkAnswerExist , checkAnswerer, listQuestionFollower } = require('../controlles/answer')
const { secret } = require('../config')

const auth = jwt({ secret })
router.get('/', find)
router.get('/:id', checkAnswerExist,  findById)
router.post('/', auth,create)
router.patch('/:id', auth, checkAnswerExist, checkAnswerer,update)
router.delete('/:id', auth, checkAnswerExist, checkAnswerer,del)
// router.get('/:id/follower', checkAnswerExist, listQuestionFollower)

module.exports = router